<?php
/**
 * DynaGrid - The PHP datagrid
 *
 * @package    DynaGrid
 * @author     $Author: keesschepers $
 * @version    $Id: Sql.php 12 2011-02-12 00:33:20Z keesschepers $
 */

ini_set('display_errors',true);
error_reporting(E_ALL);

set_include_path(get_include_path() . ':'.realpath(dirname(__FILE__) . '/../php/'));

include_once 'Grid.php';
include_once 'DataSource/Adapter/MysqliQueryParser.php';
DynaGrid_Grid::registerDataSourceAdapter(
				new DynaGrid_DataSource_Adapter_MysqliQueryParser('localhost','root','','employees')
);

$sql = 'SELECT * FROM employees';

$datagrid = new DynaGrid_Grid($sql);
$datagrid->setCaption('Title of your table!');
$datagrid->splitResults(25);

?>
<html>
	<head>
		<title>DataGrid Example</title>
		<link href="../css/dynagrid.css" type="text/css" rel="stylesheet" media="screen" />
		
		<script type="text/javascript" src="../js/jquery-1.3.2.min.js"></script>
		<script type="text/javascript" src="../js/jquery.dynagrid.src.js"></script>
		<script type="text/javascript">
			$(document).ready(function() {  	
				$('table').dynagrid();
			});
		</script>
	</head>
	<body>
		<h1>DynaGrid Mysqli Adapter example</h1>
		<?php echo $datagrid->getHTML(); ?>
		<h3>Source</h3>
    <?php show_source(__FILE__); ?>
	</body>
</html>
